package com.example.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.fragment.app.Fragment;

public class SettingsFragment extends Fragment {

    private String[] settingsOptions = {
            "服务",
            "收藏",
            "朋友圈",
            "卡包",
            "表情",
            "设置",
            "插件",
            "关于微信",
            "帮助与反馈",
            "切换账号",
            "退出"
    };

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_settings, container, false);

        ListView listView = view.findViewById(R.id.list_view);
        ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
                android.R.layout.simple_list_item_1, settingsOptions);
        listView.setAdapter(adapter);

        listView.setOnItemClickListener((parent, view1, position, id) -> {
            Intent intent = new Intent(getActivity(), BlankActivity.class);
            intent.putExtra("setting_option", settingsOptions[position]);
            startActivity(intent);
        });

        return view;
    }
}